The placeStopLimitOrder method places a stop limit order inline without the need for creating a separate Order object.
var placeStopLimitOrder(symbol, quantity, limitPrice, stopPrice, actionType, tifType);
symbol
Symbol string for which to place the order.
quantity
Floating or numeric order quantity.
limitPrice
Limit price floating value.
stopPrice
Stop price floating value.
actionType
One of the order action types such as buy or sell.
tifType
One of the time-in-force types such as Day or Good-till-Canceled.
This method returns true if order was placed successfully, false otherwise.
The following example demonstrates the use of placeStopLimitOrder method.
function init()
{
//add "Default Trading Size" parameter
addParameter("Default Trading Size", "This is the default trading size volume", 1000);
}
function start()
{
//retrieve short positions for all symbols
var account = getAccount();
var placeLongOrder = false;
var limitPrice = 0;
var stopPrice = 0;
//determine whether a long order needs to be placed
..
..
..
if(placeLongOrder)
{
var rc = account.placeStopLimitOrder(getSymbol(),
parseFloat(getParameter("Default Trading Size")),
limitPrice,
stopPrice,
ACTIONTYPE_BUY,
TIFTYPE_DAY);
}
}
init(), start(), addParameter(), getParameter()
Copyright © 2006-2009 ActiveTick LLC